package com.ict.txmsv2.mapper;

import com.ict.txmsv2.model.Role;
import com.ict.txmsv2.model.User;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserMapper {

    List<String> getAllGrade();

    int deleteByPrimaryKey(Integer id);

    int insert(User record);

    int insertSelective(User record);

    User selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    User loadUserByUsername(String username);

    List<Role> getRolesByUserId(Integer id);

    int getNewestId();

    int personCount();

    List<User> getBasic(@Param("page") Integer page, @Param("size")Integer size,
                        @Param("name")String name, @Param("dept")String dept,
                        @Param("major")String major, @Param("beginTime")String beginTime, @Param("endTime")String endTime);

    long getTotal(@Param("name")String name, @Param("dept")String dept,
                  @Param("major")String major, @Param("beginTime")String beginTime, @Param("endTime")String endTime);

    List<User> getDetail(@Param("page") Integer page, @Param("size")Integer size,
                        @Param("name")String name, @Param("dept")String dept,
                        @Param("major")String major, @Param("beginTime")String beginTime, @Param("endTime")String endTime);


    List<User> getAllUserAndHisRoles(@Param("name") String name, @Param("grade") String grade);

    int updateEnable(Integer id);

    List<String> getUserNames();

    List<User> getUsersWithClockInByDay(@Param("day") String day);

    List<User> getUsersWithClockInByDayWithPage(@Param("day") String day, @Param("ids") List<Integer> ids);


    List<Integer> getIdsWithPage(Integer page);

    List<User> getAllUserExcludeCurrentUser(Integer id);


    List<Integer> getIdsWithPage(@Param("day") String day,@Param("page") Integer page,@Param("size") Integer size);

    long getClockInTotal(@Param("day") String day);

    String getPswByUserId(Integer userId);

    void updatePsw(@Param("newPsw") String newPsw, @Param("userId") Integer userId);

    Integer getIdByUserName(String to);
}